package jmc.core.model;

// default package
// Generated 18/01/2010 12:59:49 by Hibernate Tools 3.2.0.b9



import java.math.BigDecimal;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import jmc.util.DateUtil;

/**
 * Pdproc01 generated by hbm2java
 */
@Entity
@Table(name = "PDPROC03")
public class Pdproc implements java.io.Serializable, Comparable {

	private Pdproc01Id id;
	private Pdmpro01 pdmpro01;
	private char prsect;
	private int prsucu;
	private Integer pracok;
	private int prfein = 0;
	private int prhoin = 0;
	private short prlein;
	private char prerin;
	private char prseen;
	private int prfeen;
	private int prhoen;
	private int prfeeg=0;
	private int prhoeg=0;
	private short prleeg;
	private char prereg;
	private String probse;
	private BigDecimal prcare;
	private byte propac;
	private String prusua;
	private String formatedIngreso;
	private String formatedEgreso;
	

	

	public Pdproc() {
	}

	public Pdproc(Pdproc01Id id) {
		this.id = id;
	}

	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "prseri", column = @Column(name = "PRSERI", nullable = false, length = 14)),
			@AttributeOverride(name = "prsecu", column = @Column(name = "PRSECU", nullable = false, precision = 3, scale = 0))})
	public Pdproc01Id getId() {
		return this.id;
	}

	public void setId(Pdproc01Id id) {
		this.id = id;
	}


	@Column(name = "PRSECT", nullable = false, length = 1)
	public char getPrsect() {
		return this.prsect;
	}

	public void setPrsect(char prsect) {
		this.prsect = prsect;
	}

	@Column(name = "PRSUCU", nullable = false, precision = 5, scale = 0)
	public int getPrsucu() {
		return this.prsucu;
	}

	public void setPrsucu(int prsucu) {
		this.prsucu = prsucu;
	}

	@Column(name = "PRACOK", nullable = false, precision = 3, scale = 0)
	public int getPracok() {
		return this.pracok;
	}

	public void setPracok(int pracok) {
		this.pracok = pracok;
	}

	@Column(name = "PRFEIN", nullable = false, precision = 7, scale = 0)
	public int getPrfein() {
		return this.prfein;
	}

	public void setPrfein(int prfein) {
		this.prfein = prfein;
	}

	@Column(name = "PRHOIN", nullable = false, precision = 6, scale = 0)
	public int getPrhoin() {
		return this.prhoin;
	}

	public void setPrhoin(int prhoin) {
		this.prhoin = prhoin;
	}

	@Column(name = "PRLEIN", nullable = false, precision = 4, scale = 0)
	public short getPrlein() {
		return this.prlein;
	}

	public void setPrlein(short prlein) {
		this.prlein = prlein;
	}

	@Column(name = "PRERIN", nullable = false, length = 1)
	public char getPrerin() {
		return this.prerin;
	}

	public void setPrerin(char prerin) {
		this.prerin = prerin;
	}

	@Column(name = "PRSEEN", nullable = false, length = 1)
	public char getPrseen() {
		return this.prseen;
	}

	public void setPrseen(char prseen) {
		this.prseen = prseen;
	}

	@Column(name = "PRFEEN", nullable = false, precision = 7, scale = 0)
	public int getPrfeen() {
		return this.prfeen;
	}

	public void setPrfeen(int prfeen) {
		this.prfeen = prfeen;
	}

	@Column(name = "PRHOEN", nullable = false, precision = 6, scale = 0)
	public int getPrhoen() {
		return this.prhoen;
	}

	public void setPrhoen(int prhoen) {
		this.prhoen = prhoen;
	}

	@Column(name = "PRFEEG", nullable = false, precision = 7, scale = 0)
	public int getPrfeeg() {
		return this.prfeeg;
	}

	public void setPrfeeg(int prfeeg) {
		this.prfeeg = prfeeg;
	}

	@Column(name = "PRHOEG", nullable = false, precision = 6, scale = 0)
	public int getPrhoeg() {
		return this.prhoeg;
	}

	public void setPrhoeg(int prhoeg) {
		this.prhoeg = prhoeg;
	}

	@Column(name = "PRLEEG", nullable = false, precision = 4, scale = 0)
	public short getPrleeg() {
		return this.prleeg;
	}

	public void setPrleeg(short prleeg) {
		this.prleeg = prleeg;
	}

	@Column(name = "PREREG", nullable = false, length = 1)
	public char getPrereg() {
		return this.prereg;
	}

	public void setPrereg(char prereg) {
		this.prereg = prereg;
	}

	@Column(name = "PROBSE", nullable = false, length = 140)
	public String getProbse() {
		return this.probse;
	}

	public void setProbse(String probse) {
		this.probse = probse;
	}

	@Column(name = "PRCARE", nullable = false, precision = 5, scale = 1)
	public BigDecimal getPrcare() {
		return this.prcare;
	}

	public void setPrcare(BigDecimal prcare) {
		this.prcare = prcare;
	}

	@Column(name = "PROPAC", nullable = false, precision = 2, scale = 0)
	public byte getPropac() {
		return this.propac;
	}

	public void setPropac(byte propac) {
		this.propac = propac;
	}

	@Column(name = "PRUSUA", nullable = false, length = 10)
	public String getPrusua() {
		return this.prusua;
	}

	public void setPrusua(String prusua) {
		this.prusua = prusua;
	}

	@OneToOne(fetch=FetchType.EAGER,targetEntity=Pdmpro01.class) 
	@JoinColumn (insertable=false,updatable=false, name="PRSECT")	
	public Pdmpro01 getPdmpro01() {
		return pdmpro01;
	}

	public void setPdmpro01(Pdmpro01 pdmpro01) {
		this.pdmpro01 = pdmpro01;
	}
	
	public int compareTo(Object obj) {
		Pdproc pdproc = (Pdproc)obj;
		return this.pracok.compareTo(pdproc.pracok);		
	}
	@Transient
	public String getFormatedIngreso() {
		return DateUtil.getFormatedDataAs400New(String.valueOf(this.prfein)) + " " + DateUtil.getFormatedTimeAs400New(String.valueOf(this.prhoin));
	}
	public void setFormatedIngreso(String formatedIngreso) {
		this.formatedIngreso = formatedIngreso;
	}

	
	@Transient
	public String getFormatedEgreso() {
		//return DateUtil.getFormatedDataAs400New(String.valueOf(this.prfeeg)) + " " + DateUtil.getFormatedTimeAs400New(String.valueOf(this.prhoeg));
		return DateUtil.getFormatedDataAs400New(String.valueOf(this.prfeeg));
	}
	public void setFormatedEgreso(String formatedEgreso) {
		this.formatedEgreso = formatedEgreso;
	}
	
	
}
